<template>
	<view class="container">
		<view class="s-header-box">
			<view class="s-bg-box"></view>
			<view class="s-box-info">
				<view class="s-user-info-box">
					<view class="s-user-head-portrait-box">
						<image src="../../static/logo.png"/>
					</view>
					<view class="s-user-name">{{info.nick_name}}</view>
				</view>
				<view class="s-header-list">
					<view class="s-item-value">{{info.integral || 0}}</view>
					<view class="s-item-name">积分总数</view>
				</view>
			</view>
		</view>
		<view class="content-box">
			
		</view>
		
		
		
		
		
		<view class="s-list-box">
			<s-list-view title="菜单列表" backgroundColor="#ffffff">
				<button open-type="contact" class="button" hover-class="wsui-btn__hover_list">
					<s-list-cell :arrow="true" last="true">
						<view class="s-item-box">
							<image src="../../static/images/my/contact.png" class="s-logo" mode="widthFix"></image>
							<text class="s-list-cell_name">客服</text>
						</view>
					</s-list-cell>
				</button>
				<s-list-cell :arrow="true" last="true" @click="aboutUs">
					<view class="s-item-box">
						<image src="../../static/logo.png" class="s-logo" mode="widthFix"></image>
						<text class="s-list-cell_name">使用说明</text>
					</view>
				</s-list-cell>
			</s-list-view>
		</view>
		<s-scroll-top :scrollTop="scrollTop" :isShare="true"></s-scroll-top>
		<s-footer :fixed="true" :copyright="copyright" :navigate="navigate" s-footer-class="s-custom"></s-footer>
	</view>
</template>
<script>
	import config from '../../config/config.js';
	import { getCode,showToast } from '../../utils/uniApi.js';
	import { loginApi } from '../../services/my/api.js';
	export default {
		data() {
			return {
				info:null,
				copyright: " Copyright © 2021-" + (new Date()).getFullYear() + " " + config.name,
				navigate: [{
					url: "/pages/index/index",
					type: "switchTab",
					text: config.name + "首页"
				}],
			}
		},
		async onLoad() {
			const codeInfo = await getCode();
			if(codeInfo.code){
				const loginRes = await loginApi({
					code:codeInfo.code
				});
				if(loginRes.status !== 20000){
					showToast({title:loginRes.message});
					return;
				}
				this.info = loginRes.data
			}
		},
		methods: {
		},
		onShareAppMessage(){
			return setShareAppMessage({})
		},
		onShareTimeline() {
		    return setShareAppMessage({})
		}
	}
</script>

<style lang="scss" scoped>
@import 'index.scss';
</style>
